package com.ww.basic.oop

class Vehicle(val id: Int, val year: Int) {
  override def toString = s"ID: $id Year: $year"
}

class Car2(override val id: Int, override val year: Int, var fuelLevel: Int) extends Vehicle(id, year) {
  override def toString = s"${super.toString} Fuel Level: $fuelLevel"
}

/**
 * 打印结果
 * ID: 1 Year: 2015 Fuel Level: 100
 */
object TestVehicle {
  def main(args: Array[String]): Unit = {
    val car = new Car2(1, 2015, 100)
    println(car)
  }
}
